#include<cstdio>
#include<ctime>
#include<cstdlib>
using namespace std;
typedef long long ll;
inline ll r2(){
	ll a=rand()+1,b=rand()+1;
	return (a*b)%1000000+1;
}
bool vis[1000005];
int main(){
	srand(time(0));
	freopen("airport.in","w",stdout);
	int n=5000,m1=500,m2=500;
	printf("%d %d %d\n",n,m1,m2);
	while(m1--){
		ll x=r2(),y=r2();
		while(vis[x]) x=r2();
		while(vis[y]||y<=x) y=r2();
		vis[x]=vis[y]=1;
		printf("%d %d\n",x,y);
	}
	while(m2--){
		ll x=r2(),y=r2();
		while(vis[x]) x=r2();
		while(vis[y]) y=r2();
		printf("%d %d\n",x,y);
	}
}
